package com.drone.drone_server.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.drone.drone_server.entity.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

// 飞行火情关联DAO
public interface FlightFireRelationDao extends BaseMapper<FlightFireRelation> {
    @Select("SELECT f.* FROM fire_video f " +
            "JOIN flight_fire_relation r ON f.fire_id = r.fire_id " +
            "WHERE r.flight_id = #{flightId}")
    List<FireVideo> selectFiresByFlight(@Param("flightId") Integer flightId);

    @Select("SELECT r.* FROM drone_flight_record r " +
            "JOIN flight_fire_relation f ON r.record_id = f.flight_id " +
            "WHERE f.fire_id = #{fireId}")
    List<DroneFlightRecord> selectFlightsByFire(@Param("fireId") Integer fireId);
}